﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Rcompany.Migrations
{
    public partial class Demo2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_SalesInvoice",
                table: "SalesInvoice");

            migrationBuilder.DropPrimaryKey(
                name: "PK_PaymentManagement",
                table: "PaymentManagement");

            migrationBuilder.DropPrimaryKey(
                name: "PK_PaymentApproval",
                table: "PaymentApproval");

            migrationBuilder.DropPrimaryKey(
                name: "PK_InputInvoice",
                table: "InputInvoice");

            migrationBuilder.DropColumn(
                name: "ManagementID",
                table: "PaymentManagement");

            migrationBuilder.DropColumn(
                name: "ApprovalID",
                table: "PaymentApproval");

            migrationBuilder.DropColumn(
                name: "InputID",
                table: "InputInvoice");

            migrationBuilder.RenameTable(
                name: "SalesInvoice",
                newName: "salesInvoices");

            migrationBuilder.RenameTable(
                name: "PaymentManagement",
                newName: "paymentManagements");

            migrationBuilder.RenameTable(
                name: "PaymentApproval",
                newName: "paymentApprovals");

            migrationBuilder.RenameTable(
                name: "InputInvoice",
                newName: "inputInvoices");

            migrationBuilder.AlterColumn<int>(
                name: "SalesID",
                table: "salesInvoices",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "salesInvoices",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "salesInvoices",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "salesInvoices",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "salesInvoices",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "salesInvoices",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "salesInvoices",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "salesInvoices",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "paymentManagements",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "paymentManagements",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "paymentManagements",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "paymentManagements",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "paymentManagements",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "paymentManagements",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "paymentManagements",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "paymentApprovals",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "paymentApprovals",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "paymentApprovals",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "paymentApprovals",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "paymentApprovals",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "paymentApprovals",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "paymentApprovals",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "inputInvoices",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "inputInvoices",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "inputInvoices",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "inputInvoices",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "inputInvoices",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "inputInvoices",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "inputInvoices",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddPrimaryKey(
                name: "PK_salesInvoices",
                table: "salesInvoices",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_paymentManagements",
                table: "paymentManagements",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_paymentApprovals",
                table: "paymentApprovals",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_inputInvoices",
                table: "inputInvoices",
                column: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_salesInvoices",
                table: "salesInvoices");

            migrationBuilder.DropPrimaryKey(
                name: "PK_paymentManagements",
                table: "paymentManagements");

            migrationBuilder.DropPrimaryKey(
                name: "PK_paymentApprovals",
                table: "paymentApprovals");

            migrationBuilder.DropPrimaryKey(
                name: "PK_inputInvoices",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "salesInvoices");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "paymentManagements");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "paymentApprovals");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "inputInvoices");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "inputInvoices");

            migrationBuilder.RenameTable(
                name: "salesInvoices",
                newName: "SalesInvoice");

            migrationBuilder.RenameTable(
                name: "paymentManagements",
                newName: "PaymentManagement");

            migrationBuilder.RenameTable(
                name: "paymentApprovals",
                newName: "PaymentApproval");

            migrationBuilder.RenameTable(
                name: "inputInvoices",
                newName: "InputInvoice");

            migrationBuilder.AlterColumn<int>(
                name: "SalesID",
                table: "SalesInvoice",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int")
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "ManagementID",
                table: "PaymentManagement",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "ApprovalID",
                table: "PaymentApproval",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "InputID",
                table: "InputInvoice",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddPrimaryKey(
                name: "PK_SalesInvoice",
                table: "SalesInvoice",
                column: "SalesID");

            migrationBuilder.AddPrimaryKey(
                name: "PK_PaymentManagement",
                table: "PaymentManagement",
                column: "ManagementID");

            migrationBuilder.AddPrimaryKey(
                name: "PK_PaymentApproval",
                table: "PaymentApproval",
                column: "ApprovalID");

            migrationBuilder.AddPrimaryKey(
                name: "PK_InputInvoice",
                table: "InputInvoice",
                column: "InputID");
        }
    }
}
